package com.ruifu.doc.service;

import com.fhzncloud.cloud.common.security.service.CloudUser;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;

/**
 * @author 宁义锐
 */
public interface DmFileService {
    /**
     * 文件上传
     * @param file 文件对象
     * @param cloudUser
     * @return 文件存储Id
     * @throws Exception
     */
    Long uploadFile(MultipartFile file, CloudUser cloudUser) throws Exception;

    /**
     * 文件上传不进入队列
     * @param file
     * @param cloudUser
     * @return
     * @throws Exception
     */
    Long upload(MultipartFile file, CloudUser cloudUser) throws Exception;

    /**
     * 文件下载
     * @param fiFileId 文件id
     * @param response
     * @param cloudUser
     * @throws Exception
     */
    void downloadFile(Long fiFileId, HttpServletResponse response, CloudUser cloudUser) throws Exception;

    /**
     * 文件删除
     * @param fiFileId 文件Id
     * @param cloudUser
     * @throws Exception
     */
    void deleteFile(Long fiFileId, CloudUser cloudUser) throws Exception;

    /**
     * 更换文件
     * @param fiFileId 原文件信息ID
     * @param file 新文件
     * @param cloudUser
     * @throws Exception
     */
    void changeFile(Long fiFileId, MultipartFile file, CloudUser cloudUser) throws Exception;

    /**
     * 复制文件
     * @param fiFileId 文件id
     * @param cloudUser
     * @return 复制后的文件id
     * @throws Exception
     */
    Long copyFile(Long fiFileId, CloudUser cloudUser) throws Exception;

    /**
     * 批量文件下载
     * @param fiFileIds 文件id数组
     * @param response 响应体
     * @param cloudUser
     * @throws Exception
     */
    void downloadPLFile(Long[] fiFileIds, HttpServletResponse response, CloudUser cloudUser) throws Exception;

    /**
     * 预览文件
     * @param fiFileId 文件id
     * @param cloudUser 用户对象
     * @return 文件访问路径
     */
    String previewFile(Long fiFileId, CloudUser cloudUser);
}
